package com.example.demo.repository;

import com.example.demo.entity.UserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by qwesdfok on 2017/9/30.
 */
public interface UserRepository extends JpaRepository<UserEntity, Integer> {
    @Override
    List<UserEntity> findAll();

    /**
     * 通过用户名相等查询
     *
     * @param userName 用户名
     * @return
     */
    @Query("from UserEntity u where u.nickname=:userName")
    List<UserEntity> findByUserName(String userName);

}
